package com.yxq.mdt.app.modules.socialcontact.presenter;

import com.yxq.mdt.app.base.BasePresenter;
import com.yxq.mdt.app.modules.socialcontact.bean.ByPageListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.MainSocialCircleBean;
import com.yxq.mdt.app.modules.socialcontact.model.MainSocialContactModel;
import com.yxq.mdt.app.net.ApiModel;

public class MainSocialMyCirclePresenter extends BasePresenter<MainSocialMyCircleContract.View, MainSocialContactModel> implements MainSocialMyCircleContract.Presenter {
    /**
     * 如果当前页面同时需要 Model 层和 View 层,则使用此构造函数(默认)
     *
     * @param rootView
     * @param model
     */
    public MainSocialMyCirclePresenter(MainSocialMyCircleContract.View rootView, MainSocialContactModel model) {
        super(rootView, model);
    }

    @Override
    public void getMyGroupList(int pageNum, int pageSize) {
        mBaseModel.getMyGroupList(pageNum, pageSize, new ApiModel.CommonCallback<MainSocialCircleBean>() {
            @Override
            public void onSuccess(MainSocialCircleBean s) {
                mRootView.onLoadMyGroupListSuccess(s);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadMyGroupListFailed();
            }
        });

    }
    @Override
    public void getByPageList(int pageNum, int pageSize, String groupname) {
        mBaseModel.getByPageList(pageNum, pageSize, groupname, new ApiModel.CommonCallback<ByPageListBean>() {
            @Override
            public void onSuccess(ByPageListBean byPageListBean) {
                mRootView.onLoadByPageListSuccess(byPageListBean);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadByPageListFailed();
            }
        });
    }

    @Override
    public void getRecommendGroup(String pageNum, String pageSize) {
        mBaseModel.getRecommendGroup(pageNum, pageSize, new ApiModel.CommonCallback<MainSocialCircleBean>() {
            @Override
            public void onSuccess(MainSocialCircleBean s) {
                mRootView.onLoadRecommendSuccess(s);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadRecommendFailed();
            }
        });
    }
}
